using HDLogCenter.Infrastructure.ExternalServices;
using HDLogCenter.Infrastructure.Utils;
using Quartz;

namespace HDLogCenterService.Jobs
{
    public class LogConsumerJob : IJob
    {
        private readonly LogMQMessageHandlerService _logMQMessageHandler;

        public LogConsumerJob(LogMQMessageHandlerService logMQMessageHandler)
        {
            _logMQMessageHandler = logMQMessageHandler;
        }

        public async Task Execute(IJobExecutionContext context)
        {
            try
            {
                await _logMQMessageHandler.LogHandlerAsync();
            }
            catch (Exception ex)
            {
                LogHelper.Error($"日志消息处理失败!!!ex:", ex);
            }
        }
    }
}
